<?php
/**
 * @version		1.0.0
 * @category	Anahita Social Simple Blogs
 * @copyright	Copyright (C) 2008 - 2010 rmdStudio Inc. and Peerglobe Technology Inc. All rights reserved.
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
 * @link     	http://www.anahitapolis.com
 */

/**
 *
 */
class ComQuestionsModelChoice extends AnSeMedium
{
	/**
	 * Describe the entity
	 * 
	 * @param KConfig $config
	 * @return void
	 */	
	public static function describe($config)
	{
		$config->append(array(			
			'aliases' => array(
				'question' => 'parent'
			)
		));
				
		parent::describe($config);	
	}

	/**
	 * If a method setParent is provided, then qny $chocie->parent = somevalue will invoke
	 * the $choice->setParent method. Since the question is an  alias of parent
	 * $choice->question will be changed to $choice->parent
	 *
	 * @param  ComQuestionsModelQuestion $question
	 * @return void
	 */
	public function setParent($question)
	{
		//set the choice application the same as the question
		$this->application = $question->application;
		
		 //we need to set the  choice question manually since we are overloading the
		 //the $choice->question =  
		$this->set('parent', $question);
	}
}